

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>CephFS 快照镜像 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="清理队列" href="../purge-queue/" />
    <link rel="prev" title="快照计划模块" href="../snap-schedule/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 文件系统</a></li>
      <li class="breadcrumb-item active">CephFS 快照镜像</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/cephfs/cephfs-mirroring.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id4">管理</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../createfs/"> 创建 CephFS 文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../administration/"> 管理命令</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multifs/"> 创建多个文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-remove-mds/"> 配备、增加、删除 MDS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/">术语</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds">MDS 守护进程的引用</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#id3">故障切换的管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#standby-replay">热备（ standby-replay ）的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-join-fs">配置 MDS 与文件系统的亲和性</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-configuration/"> MDS 缓存配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds-config-ref/"> MDS 配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-mds/"> ceph-mds 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/"> 通过 NFS 导出</a></li>
<li class="toctree-l3"><a class="reference internal" href="../app-best-practices/"> 应用最佳实践</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fs-volumes/"> FS 卷和子卷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../quota/"> CephFS 配额管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-messages/"> 健康消息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/">升级 MDS 集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/#firefly-jewel">升级比 Firefly 老的文件系统，需过 Jewel 这个槛</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-top/"> CephFS Top 工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snap-schedule/"> 定时快照</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> CephFS 快照镜像</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">所需条件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#cephfs-mirroring-creating-users">创建用户</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3">启动镜像守护进程</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">管理接口</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">镜像模块</a></li>
<li class="toctree-l4"><a class="reference internal" href="#cephfs-mirroring-bootstrap-peers">启动互联节点</a></li>
<li class="toctree-l4"><a class="reference internal" href="#cephfs-mirroring-mirroring-status">开始镜像快照</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id8">镜像状态</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id9">指标</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id10">配置选项</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id11">重新添加互联节点</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../purge-queue/"> 清理队列</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="cephfs">
<span id="cephfs-mirroring"></span><h1>CephFS 快照镜像<a class="headerlink" href="#cephfs" title="Permalink to this heading"></a></h1>
<p>CephFS 支持通过 <cite>cephfs-mirror</cite> 工具，把快照异步地复制到远程 CephFS 文件系统。
快照的同步方式是镜像快照数据，
然后创建一个与源快照同名（给远程文件系统上的指定目录）的远程快照。</p>
<section id="id1">
<h2>所需条件<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<p>主的（本地）和次的（远程） Ceph 集群版本应该是 Pacific 或更高版本。</p>
</section>
<section id="cephfs-mirroring-creating-users">
<span id="id2"></span><h2>创建用户<a class="headerlink" href="#cephfs-mirroring-creating-users" title="Permalink to this heading"></a></h2>
<p>首先，在主的/本地集群上给 <cite>cephfs-mirror</cite> 守护进程创建一个 Ceph 用户。
此用户需要元数据存储池的写入能力，以创建用于监视/通知操作的
RADOS 对象（索引对象），还需要数据存储池的读取能力：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph auth get-or-create client.mirror mon &#39;profile cephfs-mirror&#39; mds &#39;allow r&#39; osd &#39;allow rw tag cephfs metadata=*, allow r tag cephfs data=*&#39; mgr &#39;allow r&#39;
</pre></div>
</div>
<p>给每个文件系统互联节点（在次要的/远程集群上）创建一个 Ceph 用户。
此用户需要具备 MDS （要拍快照）和 OSD 的全部能力：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs authorize &lt;fs_name&gt; client.mirror_remote / rwps
</pre></div>
</div>
<p>添加互联节点时，这个用户是互联节点规范的一部分。</p>
</section>
<section id="id3">
<h2>启动镜像守护进程<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p>镜像守护进程应该用 <cite>systemctl(1)</cite> 单元文件启动：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ systemctl enable cephfs-mirror@mirror
$ systemctl start cephfs-mirror@mirror
</pre></div>
</div>
<p><cite>cephfs-mirror</cite> 守护进程可以在前台运行，如下：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-mirror --id mirror --cluster site-a -f
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>这里指定的用户是 <cite>mirror</cite> ，其创建方法在
<a class="reference internal" href="#cephfs-mirroring-creating-users"><span class="std std-ref">Creating Users</span></a> 说明。</p>
</div>
<p>可以部署多个 <code class="docutils literal notranslate"><span class="pre">cephfs-mirror</span></code> 守护进程，以实现并行同步和高可用性。
镜像守护进程用简单的 <code class="docutils literal notranslate"><span class="pre">M/N</span></code> 策略分担同步载荷，
其中 <code class="docutils literal notranslate"><span class="pre">M</span></code> 是目录数， <code class="docutils literal notranslate"><span class="pre">N</span></code> 是 <code class="docutils literal notranslate"><span class="pre">cephfs-mirror</span></code> 守护进程数量。</p>
<p>用 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 管理 Ceph 集群时，可运行下列命令部署 <code class="docutils literal notranslate"><span class="pre">cephfs-mirror</span></code> 守护进程：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "$ ";
}
</style><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>cephfs-mirror</span>
</pre></div></div><p>要部署多个镜像守护进程，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>cephfs-mirror<span class="w"> </span>--placement<span class="o">=</span>&lt;placement-spec&gt;</span>
</pre></div></div><p>例如，要在不同主机上部署 3 个 <cite>cephfs-mirror</cite> 守护进程，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">$<span class="w"> </span>ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>cephfs-mirror<span class="w"> </span>--placement<span class="o">=</span><span class="s2">&quot;3 host1,host2,host3&quot;</span></span>
</pre></div></div></section>
<section id="id4">
<h2>管理接口<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p><cite>Mirroring</cite> 模块（管理器插件）提供了管理目录快照镜像的接口。
这些接口（大多）是监视器命令的套壳，用于管理文件系统镜像，是建议使用的控制接口。</p>
</section>
<section id="id5">
<h2>镜像模块<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h2>
<p>镜像模块负责将目录分配给镜像守护进程进行同步。
可以派生出多个镜像守护进程，以并行地同步目录快照。
派生（或终止）镜像守护进程时，
镜像模块会发现有更改的一堆镜像守护进程，
然后重新均衡地分配一下镜像守护进程上的目录，从而提供高可用性。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>建议只部署一个镜像守护进程。
运行多个守护进程未经测试。</p>
</div>
<p>镜像功能支持的文件类型如下：</p>
<ul class="simple">
<li><p>常规文件 (-)</p></li>
<li><p>目录文件 (d)</p></li>
<li><p>符号链接 (l)</p></li>
</ul>
<p>镜像会忽略其他文件类型。因此，
在同步成功的对等节点上它们也不可用。</p>
<p>镜像模块默认是禁用的。
要启用镜像模块，运行以下命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>mgr<span class="w"> </span>module<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>mirroring</span>
</pre></div></div><p>镜像模块提供了一系列命令，
可用于控制目录快照的镜像。
要添加或删除目录，必须在指定文件系统上启用镜像功能。
要在指定文件系统上启用镜像功能，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>&lt;fs_name&gt;</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>“Mirroring module” （镜像模块）命令的前缀是 <code class="docutils literal notranslate"><span class="pre">fs</span> <span class="pre">snapshot</span> <span class="pre">mirror</span></code> 。
这样调用就把它们和“监视器命令”区分开了，监视器命令前缀是 <code class="docutils literal notranslate"><span class="pre">fs</span> <span class="pre">mirror</span></code> 。
用监视器命令启用镜像功能会导致镜像守护进程进入“失败（ failed ）”状态，
原因是缺少 <cite>cephfs_mirror</cite> 索引对象。
因此（在这种情况下）一定要用模块命令。</p>
</div>
<p>要禁用指定文件系统的镜像功能，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>disable<span class="w"> </span>&lt;fs_name&gt;</span>
</pre></div></div><p>启用镜像功能后，可以添加目录快照的镜像对端互联节点。
互联节点按照 <code class="docutils literal notranslate"><span class="pre">&lt;client&gt;&#64;&lt;cluster&gt;</span></code> 格式指定，
在本文档的其他地方叫做 <code class="docutils literal notranslate"><span class="pre">remote_cluster_spec</span></code> 。
添加互联节点时会分配一个唯一标识（ UUID ）。
有关如何创建用于做镜像的 Ceph 用户，
请参阅 <a class="reference internal" href="#cephfs-mirroring-creating-users"><span class="std std-ref">创建用户</span></a> 部分。</p>
<p>要添加互联节点，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>peer_add<span class="w"> </span>&lt;fs_name&gt;<span class="w"> </span>&lt;remote_cluster_spec&gt;<span class="w"> </span><span class="o">[</span>&lt;remote_fs_name&gt;<span class="o">]</span><span class="w"> </span><span class="o">[</span>&lt;remote_mon_host&gt;<span class="o">]</span><span class="w"> </span><span class="o">[</span>&lt;cephx_key&gt;<span class="o">]</span></span>
</pre></div></div><p><code class="docutils literal notranslate"><span class="pre">&lt;remote_cluster_spec&gt;</span></code> 的格式是 <code class="docutils literal notranslate"><span class="pre">client.&lt;id&gt;&#64;&lt;cluster_name&gt;</span></code> 。</p>
<p><code class="docutils literal notranslate"><span class="pre">&lt;remote_fs_name&gt;</span></code> 是可选的，默认值是 <cite>&lt;fs_name&gt;</cite>
（在远端集群上）。</p>
<p>这个命令要想成功执行的话，远端集群的 Ceph 配置和用户密钥环必须在主集群中能访问到。例如，
如果在远程集群上创建了名为 <code class="docutils literal notranslate"><span class="pre">client_mirror</span></code> 的用户，
该用户在名为 <code class="docutils literal notranslate"><span class="pre">remote_fs</span></code> 的远程文件系统上拥有
<code class="docutils literal notranslate"><span class="pre">rwps</span></code> 权限（参阅<cite>创建用户</cite>），且远程集群名为 <code class="docutils literal notranslate"><span class="pre">remote_ceph</span></code>
（即主集群上的远程集群配置文件名是 <code class="docutils literal notranslate"><span class="pre">remote_ceph.conf</span></code> ），
则运行以下命令，可以将远程文件系统添加成主文件系统 <code class="docutils literal notranslate"><span class="pre">primary_fs</span></code> 的对等文件系统：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>peer_add<span class="w"> </span>primary_fs<span class="w"> </span>client.mirror_remote@remote_ceph<span class="w"> </span>remote_fs</span>
</pre></div></div><p>为避免在主集群中维护远程集群配置文件和远程 ceph 用户密钥环，用户可以启动一个互联节点
（把相关远程集群的详细信息存入主集群上的监视器配置存储库中）。
参阅“<a class="reference internal" href="#cephfs-mirroring-bootstrap-peers"><span class="std std-ref">启动互联节点</span></a>”部分。</p>
<p><code class="docutils literal notranslate"><span class="pre">peer_add</span></code> 命令可以加上远程集群监视器地址和用户密钥。
不过，添加互联节点的推荐方法是启动（ bootstrap ）互联节点。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>当前只支持单个互联节点。</p>
</div>
<p>要删除一个互联节点，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>peer_remove<span class="w"> </span>&lt;fs_name&gt;<span class="w"> </span>&lt;peer_uuid&gt;</span>
</pre></div></div><p>要罗列出文件系统的镜像互联节点，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>peer_list<span class="w"> </span>&lt;fs_name&gt;</span>
</pre></div></div><p>配置一个要镜像的目录，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>add<span class="w"> </span>&lt;fs_name&gt;<span class="w"> </span>&lt;path&gt;</span>
</pre></div></div><p>要罗列配置的目录，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>ls<span class="w"> </span>&lt;fs_name&gt;</span>
</pre></div></div><p>要停止目录快照的镜像功能，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>fs<span class="w"> </span>snapshot<span class="w"> </span>mirror<span class="w"> </span>remove<span class="w"> </span>&lt;fs_name&gt;<span class="w"> </span>&lt;path&gt;</span>
</pre></div></div><p>只能用目录的绝对路径。</p>
<p>路径是由镜像模块规范化的。这意味着 <code class="docutils literal notranslate"><span class="pre">/a/b/.../b</span></code>
等同于 <code class="docutils literal notranslate"><span class="pre">/a/b</span></code> 。路径总是从 CephFS 文件系统根目录开始，
而不是从主机系统挂载点开始。</p>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ mkdir -p /d0/d1/d2
$ ceph fs snapshot mirror add cephfs /d0/d1/d2
{}
$ ceph fs snapshot mirror add cephfs /d0/d1/../d1/d2
Error EEXIST: directory /d0/d1/d2 is already tracked
</pre></div>
</div>
<p>配置好一个目录的镜像后，不允许再镜像它的子目录或它的上级目录目录：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror add cephfs /d0/d1
Error EINVAL: /d0/d1 is a ancestor of tracked path /d0/d1/d2
$ ceph fs snapshot mirror add cephfs /d0/d1/d2/d3
Error EINVAL: /d0/d1/d2/d3 is a subtree of tracked path /d0/d1/d2
</pre></div>
</div>
<p><a class="reference internal" href="#cephfs-mirroring-mirroring-status"><span class="std std-ref">镜像状态</span></a>段落包含一些信息，是用于检查目录映射（到镜像守护进程的）和检查目录分布的命令。</p>
</section>
<section id="cephfs-mirroring-bootstrap-peers">
<span id="id6"></span><h2>启动互联节点<a class="headerlink" href="#cephfs-mirroring-bootstrap-peers" title="Permalink to this heading"></a></h2>
<p>添加互联节点（通过 <cite>peer_add</cite> ）时，要求在主集群（管理器主机和运行镜像守护进程的主机）上能看到互联节点的集群配置和用户密钥环。
这可以通过启动和导入一个互联节点的令牌来避免。
互联节点的启动包括在互联集群上创建一个启动令牌：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror peer_bootstrap create &lt;fs_name&gt; &lt;client_entity&gt; &lt;site-name&gt;
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror peer_bootstrap create backup_fs client.mirror_remote site-remote
{&quot;token&quot;: &quot;eyJmc2lkIjogIjBkZjE3MjE3LWRmY2QtNDAzMC05MDc5LTM2Nzk4NTVkNDJlZiIsICJmaWxlc3lzdGVtIjogImJhY2t1cF9mcyIsICJ1c2VyIjogImNsaWVudC5taXJyb3JfcGVlcl9ib290c3RyYXAiLCAic2l0ZV9uYW1lIjogInNpdGUtcmVtb3RlIiwgImtleSI6ICJBUUFhcDBCZ0xtRmpOeEFBVnNyZXozai9YYUV0T2UrbUJEZlJDZz09IiwgIm1vbl9ob3N0IjogIlt2MjoxOTIuMTY4LjAuNTo0MDkxOCx2MToxOTIuMTY4LjAuNTo0MDkxOV0ifQ==&quot;}
</pre></div>
</div>
<p><cite>site-name</cite> 指的是用户定义的字符串，用于标识远程文件系统。在 <cite>peer_add</cite> 接口的上下文中， <cite>site-name</cite> 就是 <cite>remote_cluster_spec</cite> 里传入的集群名（ <cite>cluster_name</cite> ）。</p>
<p>在主集群里导入启动令牌，用命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror peer_bootstrap import &lt;fs_name&gt; &lt;token&gt;
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror peer_bootstrap import cephfs eyJmc2lkIjogIjBkZjE3MjE3LWRmY2QtNDAzMC05MDc5LTM2Nzk4NTVkNDJlZiIsICJmaWxlc3lzdGVtIjogImJhY2t1cF9mcyIsICJ1c2VyIjogImNsaWVudC5taXJyb3JfcGVlcl9ib290c3RyYXAiLCAic2l0ZV9uYW1lIjogInNpdGUtcmVtb3RlIiwgImtleSI6ICJBUUFhcDBCZ0xtRmpOeEFBVnNyZXozai9YYUV0T2UrbUJEZlJDZz09IiwgIm1vbl9ob3N0IjogIlt2MjoxOTIuMTY4LjAuNTo0MDkxOCx2MToxOTIuMTY4LjAuNTo0MDkxOV0ifQ==
</pre></div>
</div>
</section>
<section id="cephfs-mirroring-mirroring-status">
<span id="id7"></span><h2>开始镜像快照<a class="headerlink" href="#cephfs-mirroring-mirroring-status" title="Permalink to this heading"></a></h2>
<p>要启动快照镜像，在主集群中给已配置的目录创建一个快照：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ mkdir -p /d0/d1/d2/.snap/snap1
</pre></div>
</div>
</section>
<section id="id8">
<h2>镜像状态<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h2>
<p>CephFS 镜像模块提供了 <cite>mirror daemon status</cite> 接口，用于检查镜像守护进程的状态：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror daemon status
[
  {
    &quot;daemon_id&quot;: 284167,
    &quot;filesystems&quot;: [
      {
        &quot;filesystem_id&quot;: 1,
        &quot;name&quot;: &quot;a&quot;,
        &quot;directory_count&quot;: 1,
        &quot;peers&quot;: [
          {
            &quot;uuid&quot;: &quot;02117353-8cd1-44db-976b-eb20609aa160&quot;,
            &quot;remote&quot;: {
              &quot;client_name&quot;: &quot;client.mirror_remote&quot;,
              &quot;cluster_name&quot;: &quot;ceph&quot;,
              &quot;fs_name&quot;: &quot;backup_fs&quot;
            },
            &quot;stats&quot;: {
              &quot;failure_count&quot;: 1,
              &quot;recovery_count&quot;: 0
            }
          }
        ]
      }
    ]
  }
]
</pre></div>
</div>
<p>每个镜像守护进程实例都会显示一个条目，以及已配置的互联节点和基本统计信息。
想知道更详细的统计信息，可以用管理套接字接口，详情如下。</p>
<p>CephFS 镜像守护进程提供用于查询镜像状态的管理员套接字命令。
要查看和镜像状态有关的命令，用：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph --admin-daemon /path/to/mirror/daemon/admin/socket help
{
    ....
    ....
    &quot;fs mirror status cephfs@360&quot;: &quot;get filesystem mirror status&quot;,
    ....
    ....
}
</pre></div>
</div>
<p>以 <code class="docutils literal notranslate"><span class="pre">fs</span> <span class="pre">mirror</span> <span class="pre">status</span></code> 为前缀的命令可查看镜像状态，适用于启用了镜像功能的文件系统。
注意， <cite>cephfs&#64;360</cite> 是按照 <cite>filesystem-name&#64;filesystem-id</cite> 这个格式。
需要使用这种格式，是因为镜像守护进程会异步地收到有关文件系统镜像状态的通知
（文件系统可以用同一名称删除和重新创建）。</p>
<p>该命令目前只提供有关镜像状态的最基本信息：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror status cephfs@360
{
  &quot;rados_inst&quot;: &quot;192.168.0.5:0/1476644347&quot;,
  &quot;peers&quot;: {
      &quot;a2dc7784-e7a1-4723-b103-03ee8d8768f8&quot;: {
          &quot;remote&quot;: {
              &quot;client_name&quot;: &quot;client.mirror_remote&quot;,
              &quot;cluster_name&quot;: &quot;site-a&quot;,
              &quot;fs_name&quot;: &quot;backup_fs&quot;
          }
      }
  },
  &quot;snap_dirs&quot;: {
      &quot;dir_count&quot;: 1
  }
}
</pre></div>
</div>
<p>上面命令输出中的 <cite>Peers</cite> 一段显示的是互联节点信息，包括唯一的互联节点标识
（ UUID ）和镜像规范。删除现有互联节点时需要使用互联节点 ID （ peer-id ），
在<cite>镜像模块和接口</cite>小节说过了。</p>
<p>以 <code class="docutils literal notranslate"><span class="pre">fs</span> <span class="pre">mirror</span> <span class="pre">peer</span> <span class="pre">status</span></code> 为前缀的命令能查看互联节点的同步状态。
命令格式为 <cite>filesystem-name&#64;filesystem-id peer-uuid</cite>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror peer status cephfs@360 a2dc7784-e7a1-4723-b103-03ee8d8768f8
{
  &quot;/d0&quot;: {
      &quot;state&quot;: &quot;idle&quot;,
      &quot;last_synced_snap&quot;: {
          &quot;id&quot;: 120,
          &quot;name&quot;: &quot;snap1&quot;,
          &quot;sync_duration&quot;: 3,
          &quot;sync_time_stamp&quot;: &quot;274900.558797s&quot;,
          &quot;sync_bytes&quot;: 52428800
      },
      &quot;snaps_synced&quot;: 2,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  }
}
</pre></div>
</div>
<p>当重启守护进程和/或把目录重新分配给另一个镜像守护进程时
（假设部署了多个镜像守护进程），包括 <cite>snaps_synced</cite> 、 <cite>snaps_deleted</cite> 和
<cite>snaps_renamed</cite> 在内的这些同步统计信息将被重置。</p>
<p>目录状态可以是以下之一：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>- `idle`: 此目录当前尚未同步
- `syncing`: 此目录当前正在同步
- `failed`: 此目录已达到最大连续失败数
</pre></div>
</div>
<p>当现在正同步某个目录时，镜像守护进程会把它标记为 <cite>syncing</cite> ，并且
<cite>fs mirror peer status</cite> 会在 <cite>current_syncing_snap</cite> 内显示正在同步的快照：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror peer status cephfs@360 a2dc7784-e7a1-4723-b103-03ee8d8768f8
{
  &quot;/d0&quot;: {
      &quot;state&quot;: &quot;syncing&quot;,
      &quot;current_syncing_snap&quot;: {
          &quot;id&quot;: 121,
          &quot;name&quot;: &quot;snap2&quot;
      },
      &quot;last_synced_snap&quot;: {
          &quot;id&quot;: 120,
          &quot;name&quot;: &quot;snap1&quot;,
          &quot;sync_duration&quot;: 3,
          &quot;sync_time_stamp&quot;: &quot;274900.558797s&quot;,
          &quot;sync_bytes&quot;: 52428800
      },
      &quot;snaps_synced&quot;: 2,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  }
}
</pre></div>
</div>
<p>同步完成后，镜像守护进程仍然把它标记为 <cite>idle</cite> 。</p>
<p>当某个目录同步的连续失败次数达到设定值时，镜像守护进程会把它标记为 <cite>failed</cite> 。
稍后会重试同步这些目录。默认情况下，目录被标记为失败的连续失败次数由
<cite>cephfs_mirror_max_consecutive_failures_per_directory</cite> 配置选项控制
（默认值： 10 ），失败目录的重试间隔由
<cite>cephfs_mirror_retry_failed_directories_interval</cite> 配置选项控制（默认值：60s）。</p>
<p>例如，添加一个普通文件进行同步会导致失败状态：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs snapshot mirror add cephfs /f0
$ ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror peer status cephfs@360 a2dc7784-e7a1-4723-b103-03ee8d8768f8
{
  &quot;/d0&quot;: {
      &quot;state&quot;: &quot;idle&quot;,
      &quot;last_synced_snap&quot;: {
          &quot;id&quot;: 121,
          &quot;name&quot;: &quot;snap2&quot;,
          &quot;sync_duration&quot;: 5,
          &quot;sync_time_stamp&quot;: &quot;500900.600797s&quot;,
          &quot;sync_bytes&quot;: 78643200
      },
      &quot;snaps_synced&quot;: 3,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  },
  &quot;/f0&quot;: {
      &quot;state&quot;: &quot;failed&quot;,
      &quot;snaps_synced&quot;: 0,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  }
}
</pre></div>
</div>
<p>系统允许用户添加不存在的目录进行同步。镜像守护进程会把此类目录标记为失败并重试
（频率较低）。这个目录创建后，镜像守护进程会在同步成功后清除之前标记的失败状态。</p>
<p>在远程文件系统的 .snap 目录中手动增加新快照或新目录，
会导致配置的对应目录进入失败状态。在远程文件系统中操作：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs subvolume snapshot create cephfs subvol1 snap2 group1
or
$ mkdir /d0/.snap/snap2

$ ceph --admin-daemon /var/run/ceph/cephfs-mirror.asok fs mirror peer status cephfs@360 a2dc7784-e7a1-4723-b103-03ee8d8768f8
{
  &quot;/d0&quot;: {
      &quot;state&quot;: &quot;failed&quot;,
      &quot;failure_reason&quot;: &quot;snapshot &#39;snap2&#39; has invalid metadata&quot;,
      &quot;last_synced_snap&quot;: {
          &quot;id&quot;: 120,
          &quot;name&quot;: &quot;snap1&quot;,
          &quot;sync_duration&quot;: 3,
          &quot;sync_time_stamp&quot;: &quot;274900.558797s&quot;
      },
      &quot;snaps_synced&quot;: 2,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  },
  &quot;/f0&quot;: {
      &quot;state&quot;: &quot;failed&quot;,
      &quot;snaps_synced&quot;: 0,
      &quot;snaps_deleted&quot;: 0,
      &quot;snaps_renamed&quot;: 0
  }
}
</pre></div>
</div>
<p>当远程文件系统删除快照或目录后，镜像守护进程将在成功地同步以前积攒的待处理快照（如有的话）后清除 failed 状态。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>把远程文件系统当作只读的。 CephFS 本身没有什么必须要做的操作。
但是， mds 能力配置正确的话，在远程文件系统上，用户就无法对目录拍快照。</p>
</div>
<p>禁用镜像功能后，对应文件系统的 <cite>fs mirror status</cite> 命令就不会显示在命令帮助中。</p>
</section>
<section id="id9">
<h2>指标<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h2>
<p>CephFS 把镜像指标导出成了 <a class="reference internal" href="../../dev/perf_counters/#labeled-perf-counters"><span class="std std-ref">带标签的性能计数器</span></a> ， OCP/ODF Dashboard 将使用这些计数器来做 Geo Replication 监控。这些指标可用于衡量 cephfs_mirror 同步的进度，
从而提供监控功能。 CephFS 会导出以下镜像指标，用 <code class="docutils literal notranslate"><span class="pre">counter</span> <span class="pre">dump</span></code> 命令可显示这些指标。</p>
<table class="docutils align-default" id="id12">
<caption><span class="caption-text">镜像状态指标</span><a class="headerlink" href="#id12" title="Permalink to this table"></a></caption>
<colgroup>
<col style="width: 20.0%" />
<col style="width: 20.0%" />
<col style="width: 60.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>名字</p></th>
<th class="head"><p>类型</p></th>
<th class="head"><p>描述</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>mirroring_peers</p></td>
<td><p>Gauge</p></td>
<td><p>镜像涉及的互联节点数量</p></td>
</tr>
<tr class="row-odd"><td><p>directory_count</p></td>
<td><p>Gauge</p></td>
<td><p>需要同步的目录总数</p></td>
</tr>
<tr class="row-even"><td><p>mirrored_filesystems</p></td>
<td><p>Gauge</p></td>
<td><p>要镜像的文件系统总数</p></td>
</tr>
<tr class="row-odd"><td><p>mirror_enable_failures</p></td>
<td><p>Counter</p></td>
<td><p>镜像功能启用失败</p></td>
</tr>
</tbody>
</table>
<table class="docutils align-default" id="id13">
<caption><span class="caption-text">复制指标</span><a class="headerlink" href="#id13" title="Permalink to this table"></a></caption>
<colgroup>
<col style="width: 20.0%" />
<col style="width: 20.0%" />
<col style="width: 60.0%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>名字</p></th>
<th class="head"><p>类型</p></th>
<th class="head"><p>描述</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>snaps_synced</p></td>
<td><p>Counter</p></td>
<td><p>成功同步的快照总数</p></td>
</tr>
<tr class="row-odd"><td><p>sync_bytes</p></td>
<td><p>Counter</p></td>
<td><p>已同步的总字节数</p></td>
</tr>
<tr class="row-even"><td><p>sync_failures</p></td>
<td><p>Counter</p></td>
<td><p>快照同步的失败总数</p></td>
</tr>
<tr class="row-odd"><td><p>snaps_deleted</p></td>
<td><p>Counter</p></td>
<td><p>删掉的快照总数</p></td>
</tr>
<tr class="row-even"><td><p>snaps_renamed</p></td>
<td><p>Counter</p></td>
<td><p>重命名的快照总数</p></td>
</tr>
<tr class="row-odd"><td><p>avg_sync_time</p></td>
<td><p>Gauge</p></td>
<td><p>所有快照同步花费的时间平均值</p></td>
</tr>
<tr class="row-even"><td><p>last_synced_start</p></td>
<td><p>Gauge</p></td>
<td><p>上次同步快照的同步开始时间</p></td>
</tr>
<tr class="row-odd"><td><p>last_synced_end</p></td>
<td><p>Gauge</p></td>
<td><p>上次同步快照的同步结束时间</p></td>
</tr>
<tr class="row-even"><td><p>last_synced_duration</p></td>
<td><p>Gauge</p></td>
<td><p>上次同步的持续时间</p></td>
</tr>
<tr class="row-odd"><td><p>last_synced_bytes</p></td>
<td><p>counter</p></td>
<td><p>上次同步的快照，同步过去的总字节数</p></td>
</tr>
</tbody>
</table>
</section>
<section id="id10">
<h2>配置选项<a class="headerlink" href="#id10" title="Permalink to this heading"></a></h2>
<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_max_concurrent_directory_syncs">
<span class="sig-name descname"><span class="pre">cephfs_mirror_max_concurrent_directory_syncs</span></span><a class="headerlink" href="#confval-cephfs_mirror_max_concurrent_directory_syncs" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>cephfs-mirror 守护进程最多可以同时同步多少目录快照。 控制的是同步线程的数量。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">3</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_action_update_interval">
<span class="sig-name descname"><span class="pre">cephfs_mirror_action_update_interval</span></span><a class="headerlink" href="#confval-cephfs_mirror_action_update_interval" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>处理未完成镜像更新操作的时间间隔，单位为秒。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">secs</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">2</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_restart_mirror_on_blocklist_interval">
<span class="sig-name descname"><span class="pre">cephfs_mirror_restart_mirror_on_blocklist_interval</span></span><a class="headerlink" href="#confval-cephfs_mirror_restart_mirror_on_blocklist_interval" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>被阻塞的（ blocklisted ）镜像例程的重启时间间隔，秒数。 设置为零（ 0 ）意思是禁止重启被阻塞的例程。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">secs</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">30</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_max_snapshot_sync_per_cycle">
<span class="sig-name descname"><span class="pre">cephfs_mirror_max_snapshot_sync_per_cycle</span></span><a class="headerlink" href="#confval-cephfs_mirror_max_snapshot_sync_per_cycle" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>镜像工作线程选中目录开始镜像时， 一个周期可以选中的最大快照数。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">3</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_directory_scan_interval">
<span class="sig-name descname"><span class="pre">cephfs_mirror_directory_scan_interval</span></span><a class="headerlink" href="#confval-cephfs_mirror_directory_scan_interval" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>快照镜像程序对配置的目录间隔多少秒扫描一次。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">10</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_max_consecutive_failures_per_directory">
<span class="sig-name descname"><span class="pre">cephfs_mirror_max_consecutive_failures_per_directory</span></span><a class="headerlink" href="#confval-cephfs_mirror_max_consecutive_failures_per_directory" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>连续的快照同步失败多少次，就把这个目录标记为 “failed” 。 失败的目录在同步时的重试频率低一些。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">10</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_retry_failed_directories_interval">
<span class="sig-name descname"><span class="pre">cephfs_mirror_retry_failed_directories_interval</span></span><a class="headerlink" href="#confval-cephfs_mirror_retry_failed_directories_interval" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>对于失败的目录，同步时的重试时间间隔。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">uint</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">60</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_restart_mirror_on_failure_interval">
<span class="sig-name descname"><span class="pre">cephfs_mirror_restart_mirror_on_failure_interval</span></span><a class="headerlink" href="#confval-cephfs_mirror_restart_mirror_on_failure_interval" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>间隔多少秒重启一次失败的镜像例程。 设置为零（ 0 ）意思是禁止重启失败的镜像例程。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">secs</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">20</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_mount_timeout">
<span class="sig-name descname"><span class="pre">cephfs_mirror_mount_timeout</span></span><a class="headerlink" href="#confval-cephfs_mirror_mount_timeout" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>cephfs-mirror 守护进程挂载主的或次要的（远程的） ceph 文件系统的超时时间，秒数。如果集群不可达，
把此值设置得过高可能导致镜像守护进程在挂载文件系统时卡死。 此选项用于覆盖常见的 client_mount_timeout 。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">secs</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">10</span></code></p>
</dd>
<dt class="field-odd">min<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt class="sig sig-object std" id="confval-cephfs_mirror_perf_stats_prio">
<span class="sig-name descname"><span class="pre">cephfs_mirror_perf_stats_prio</span></span><a class="headerlink" href="#confval-cephfs_mirror_perf_stats_prio" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>如果优先级不是低于 mgr_stats_threshold ，这个守护进程就会把性能计数器数据发给管理器守护进程。</p>
<dl class="field-list simple">
<dt class="field-odd">type<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">int</span></code></p>
</dd>
<dt class="field-even">default<span class="colon">:</span></dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">5</span></code></p>
</dd>
<dt class="field-odd">allowed range<span class="colon">:</span></dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">[0,</span> <span class="pre">11]</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

</section>
<section id="id11">
<h2>重新添加互联节点<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h2>
<p>给另一个集群的文件系统重新添加（重新分配）一个互联节点时，要确保所有镜像守护进程都已停止向这个互联节点的同步。可以用 <cite>fs mirror status</cite> admin socket
命令来检查（命令输出中应该不会显示 <cite>Peer UUID</cite> ）。而且，想要把这个互联节点重新添加给另一个文件系统的话，建议先清除它上面已经同步的目录
（尤其是新的主文件系统中可能存在的同名目录）。
如果还是把互联节点重新添加到先前同步的同一个主文件系统，那就不需要清除。</p>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../snap-schedule/" class="btn btn-neutral float-left" title="快照计划模块" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../purge-queue/" class="btn btn-neutral float-right" title="清理队列" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>